<?php
	$protectid="305"; 
	include("../protect.php");
	
	include_once("../../config.inc.php");
	
	include_once(CFG_LIB_DIR.'mysqldb.inc.php');
	$objDb = new mysqldb();
	

	include_once(CFG_LIB_DIR."buy_car_cs.php");
	$objBuyCar = new Buy_CS();
	
	include_once(CFG_LIB_DIR."manage_page.php");	
	$objManPage = new clsManagePage();
	 $orderid= $_GET['id'];
	
	//分页获取数据
	//$OrderResult = $objManPage->GetResult('*', '', " ORDER BY CreateTime DESC", 20, true);
	$sql="select * from ".con_strPREFIX."buyorder where ID='".$orderid."' ";
	$objDb->query($sql);
	$OrderResult=$objDb->get_data();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator's Control Panel</title>
<?php include_once("../common/files.php"); ?>
</head>
<body id="main" >

<table cellspacing="0" cellpadding="0" width="100%"  class="listtable">
    <tr>
      <th width="10%">订单号</th>
      <th width="10%">订购者</th>
      <th width="10%">联系电话</th>
      <th width="15%">送餐地址</th>
      <th width="10%">送餐时间</th>
      <th width="10%">订购时间</th>
      <th width="20%">留言</th>
    </tr>
<?php
	//输出 Manage Grid
	if(is_array($OrderResult))
	{
		$intNotRead=0;
		foreach($OrderResult as $key => $Order)
		{
			if($Order['IsRead']==0){$strRead="未处理";$blnISRead=1;$strColor="red";$intNotRead ++;}
			else{$strRead="已处理";$blnISRead=0;$strColor="";}
?>
    <tr>
    	<td align="center"><?php echo $Order['ID'];?></td>
    	<td align="center"><?php echo $Order['PersonName'];?></td>
        <td align="center"><?php echo $Order['Telephoto'];?></td>
        <td align="center"><?php echo $Order['Address'];?></td>
        <td align="center"><?php echo $Order['SendTime'];?></td>
        <td align="center"><?php echo date("Y-m-d H:i:s",$Order['CreateTime']);?></td>
        <td align="center"><?php echo $Order['Message'];?></td>
   </tr>
    <tr id="contenttr<?=$Order['ID']?>">
      <td colspan="7" align="left" bgcolor="#F8FBFC">
        	<table width="100%" border="1" bordercolordark="#FFFFFF" bordercolorlight="#000000" cellpadding="0" cellspacing="0">
                <tr>
                    <td bgcolor="#EEF9FF">序号</td>
          			<td bgcolor="#EEF9FF">名称</td>
                    <td bgcolor="#EEF9FF">数量</td>
                    <td bgcolor="#EEF9FF">单价</td>
                    <td bgcolor="#EEF9FF">金额</td>
                </tr>
                <?php
                $rs=$objBuyCar->GetOrderProduct($Order['ID']);
                $fltAllMoney=0;
                if($rs){
                    foreach($rs as $key=>$v){
                        $fltMoney=$v["ProductPrice"]*$v["BuyNumber"];
                        $fltAllMoney +=$fltMoney;
                ?>
                <tr>
                    <td><?=$v['ID']?></td>
                    <td><?=$v['ProductName']?></td>
                    <td><?=$v['BuyNumber']?></td>
                    <td><?=$v['ProductPrice']?>元</td>
                    <td><?=$fltMoney?>元</td>
                </tr>
                <?php
                    }
                }
                ?>
                <tr>
                  <td colspan="5" align="right" bgcolor="#EEF9FF">合计：<?=$fltAllMoney?>元&nbsp;</td>
                </tr>
            </table>
      </td>
    </tr>
<?php	
		}
	}
?>
</table>
<div style="text-align:center; padding-top:50px;"><input name="" type="button" value="打印" onclick="this.style.display='none';window.print();" /></div>

</body>
</html>
